package com.nineclock.approve.nodeResolver.impl;

import cn.hutool.json.JSONObject;
import com.nineclock.approve.nodeResolver.ProcessNodeResolver;
import org.activiti.bpmn.model.Process;
import org.activiti.bpmn.model.UserTask;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
public class ApproveNodeResolver extends ProcessNodeResolver {
    @Override
    public void addFlowNodeToActiviti(Process process, JSONObject currNode, JSONObject nextNode) {
        UserTask userTask = new UserTask();
        userTask.setId(getNodeId(currNode));
        userTask.setName(currNode.getStr("name"));
        userTask.setCategory("1");

        process.addFlowElement(userTask);

        //绘制连线节点
        this.addSequenceFlowToActiviti(process, currNode, nextNode);
    }
}
